package com.maxmlr.mybatisplus.resut;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.maxmlr.mybatisplus.enums.ErrorCode;

import java.util.Date;

public class ResultBean extends Bean {
	private static final long serialVersionUID = 1L;

	protected long code = ErrorCode.SUCCESS.getCode();
	protected String msg = ErrorCode.SUCCESS.getMsg();
	protected Object data;
	protected Date dateTime = new Date();

	public ResultBean() {
		super();
	}

	public ResultBean(Page<?> page) {
		super();
		setData(page);
	}

	public ResultBean(Object data) {
		super();
		this.data = data;
	}

	public ResultBean(long code, String msg) {
		super();
		this.code = code;
		this.msg = msg;
	}

	public ResultBean(long code, String msg, Object data) {
		super();
		this.code = code;
		this.msg = msg;
		this.data = data;
	}

	public void setData(Page<?> page) {
		this.data = page.getRecords();
	}

	public long getCode() {
		return code;
	}

	public void setCode(long code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Date getDateTime() {
		return dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

}
